package common;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import math.probability.ProbDistribution;

public class StructuralModel {
	private int N;
	private ProbDistribution distX;
	private ProbDistribution distKsi;
	private ProbDistribution distEps;
	private Double b0;
	private Double b1;
	
	
	
	public StructuralModel(int n, ProbDistribution distX,
			ProbDistribution distKsi, ProbDistribution distEps, Double b0,
			Double b1) {
		N = n;
		this.distX = distX;
		this.distKsi = distKsi;
		this.distEps = distEps;
		this.b0 = b0;
		this.b1 = b1;
	}


	public Map<Double, Double> getData() {
		Map<Double, Double> V_U = new HashMap<Double, Double>();
		ArrayList<Double> smplX = distX.getSample(N);
		ArrayList<Double> ksi = distKsi.getSample(N);
		ArrayList<Double> eps = distEps.getSample(N);
//		double sumU = 0.0;
//		double sumV = 0.0;
		for (int i = 0; i < N; i++) {
			Double V = (b0+b1*smplX.get(i) + eps.get(i));
			Double U = (smplX.get(i) + ksi.get(i));
//			sumU += U;
//			sumV += V;
			V_U.put(U, V);
		}
		return V_U;
			
	}

}
